<template>
	<view class="">
		<view class="single-img" v-if="type===1">
			<image :src="codeImg" mode="widthFix" class="code-img" show-menu-by-longpress></image>
		</view>
		<view class="user-code-view fx-colum-center" v-if="type===2">
			<image :src="codeImg" mode="widthFix" class="code-img" show-menu-by-longpress
				@click="$api.toPreviewImg(codeImg)"></image>
			<view class="">长按识别二维码添加微信好友</view>
		</view>
	</view>

</template>

<script>
	export default {
		data() {
			return {
				codeImg: '',
				type: 1, //1首页工作群，2项目沟通
			};
		},
		onLoad(e) {
			if (e.img) {
				this.codeImg = e.img
			}
			if (e.type) {
				this.type = Number(e.type)
			}
			if (e.title) {
				uni.setNavigationBarTitle({
					title: e.title
				})
			}
		},

	}
</script>

<style scoped lang="scss">
	.user-code-view {
		background-color: #ffffff;
		border-radius: 16rpx;
		margin: 28rpx;
		padding: 20% 0 30%;
		font-size: 28rpx;
		color: #AFAFAF;

		.code-img {
			width: 512rpx;
			height: 516rpx;
			margin-bottom: 26rpx;
		}
	}

	.single-img {
		width: 100%;

		image {
			width: 100%;
			height: 100%;
		}
	}
</style>